{include file="public/header" /}

<div class="page">
        <form id="goods_class_form" method="post" name="form1" enctype="multipart/form-data">
            <input type="hidden" name="project_id" value="{$project_id}" />
            <table class="ds-default-table">
                <tbody>
                <tr class="noborder">
                    <td class="required w100" style="width: 72px;"><label class="validation">数量:</label></td>
                    <td class="vatop rowform"><input style="width: 100px;" type="text" value="{$num}" name="num" id="num" class="txt"></td>
                    <td style="width: 200px;" class="vatop tips"></td>
                </tr>
                <tfoot>
                <tr class="tfoot" style="text-align:center;">
                    <td colspan="15" ><input style="line-height: 10px;" class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
                </tr>
                </tfoot>
                </tbody>
                <tfoot>
                </tfoot>
            </table>
        </form>
    </div>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<script>
    function call_back(picname){
        $('#brand_pic').val(picname);
        $('#view_img').attr('src','{$Think.UPLOAD_SITE_URL}/{$Think.ATTACH_BRAND}/'+picname);
    }
    $(function () {
        jQuery.validator.addMethod("checkFCodePrefix", function (value, element) {
            return this.optional(element) || /^[a-zA-Z]+$/.test(value);
        }, '<i class="iconfont">&#xe64c;</i>{$Think.lang.prompt_information1}');

        $('#goods_class_form').validate({
            errorPlacement: function (error, element) {
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules: {
                num: {
                    required: true,
                    digits: true,
                },
            },
            messages: {
                num: {
                    required: '数量不能为空',
                    digits: '请输入正确数字'
                },
            }
        });
    });
    //按钮先执行验证再提交表单
    $(function(){
        // 编辑分类时清除分类信息
        $('.edit_gcategory').click(function(){
            $('input[name="class_id"]').val('');
            $('input[name="brand_class"]').val('');
        });

        var textButton1="<input type='text' name='textfield' id='textfield1' class='type-file-text' /><input type='button' name='button' id='button1' value='' class='type-file-button' />"
        $(textButton1).insertBefore("#project_images");
        $("#project_images").change(function(){$("#textfield1").val($("#project_images").val());});
        jQuery.validator.addMethod("initial", function(value, element) {
            return /^[A-Za-z0-9]$/i.test(value);
        }, "");
    });

    gcategoryInit('gcategory');

    function edit_band_goods(ids_str) {
        
      _uri = ADMINSITEURL+"/Goodproject/edit_band_goods?projectid=" + ids_str;
        dsLayerOpen(_uri,'绑定商品','600px','400px');
    }
</script>